<template>
  <el-col style="margin: 10px auto;max-width: calc(100vw - 210px);">
    <div style="margin-top: 50px;"></div>
    <div style="min-height: 20%">
      <el-card style="border-radius: 20px">
        <el-button-group class="ml-4">
          <el-button link type="primary" @click="myaddition">我添加的</el-button>
          <el-button link type="primary" @click="myhandle">我处理的</el-button>
        </el-button-group>
        <el-button type="primary" @click="addition=true" style="margin-left: calc(100vw - 500px)">录入简历</el-button>
      </el-card>
      <el-card style="border-radius: 20px;margin-top: 10px">
        <el-table
            :data="ResumeList"
            style="border-radius: 15px"
            height="530"
        >
          <el-table-column prop="resumename" label="姓名"/>
          <el-table-column prop="gender" label="性别"/>
          <el-table-column prop="age" label="年龄"/>
          <el-table-column prop="salarye" label="期望薪资"/>
          <el-table-column prop="salaryn" label="目前薪资"/>
          <el-table-column prop="inde" label="期望行业"/>
          <el-table-column prop="rstate" label="人才状态"
                           :filters="[
                               {text:'待初筛',value:'待初筛'},
                               {text:'已初筛',value:'已初筛'},
                               {text:'已推荐',value:'已推荐'},
                               {text:'已初试',value:'已初试'},
                               {text:'已复试',value:'已复试'},
                               {text:'已终试',value:'已终试'},
                               {text:'已offer',value:'已offer'},
                               {text:'已入职',value:'已入职'},
                               {text:'已过保',value:'已过保'},
                               {text:'已淘汰',value:'已淘汰'},
                           ]"
                           :filter-method="select"
          >
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <el-button link type="primary">预览简历</el-button>
          </el-table-column>
        </el-table>
      </el-card>
    </div>
  </el-col>
  <el-dialog v-model="addition">
    <span>
      <el-form label-width="120px" :model="newResume">
        <el-row>
         <el-form-item label="姓名">
          <el-input v-model="newResume.resumename" clearable placeholder="(必填)"/>
         </el-form-item>
         <el-form-item label="性别">
          <el-select v-model="newResume.gender">
           <el-option label="男" value="男"/>
           <el-option label="女" value="女"/>
          </el-select>
         </el-form-item>
        </el-row>
        <el-row>
        <el-form-item label="年龄">
          <el-input v-model="newResume.age"></el-input>
        </el-form-item>
          <el-form-item label="投递职位">
            <el-input v-model="newResume.position" clearable placeholder="(必填)"/>
          </el-form-item>
        </el-row>
        <el-row>
        <el-form-item label="期望薪资" style="width: 44%;">
          <el-input v-model="newResume.salarye">
            <template #append>元</template>
          </el-input>
        </el-form-item>
        <el-form-item label="当前薪资" style="width: 43%;">
          <el-input v-model="newResume.salaryn">
            <template #append>元</template>
          </el-input>
        </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="期望行业">
            <el-input v-model="newResume.inde" clearable placeholder="(必填)"/>
          </el-form-item>
          <el-form-item label="当前行业">
            <el-input v-model="newResume.indn" clearable/>
          </el-form-item>
          </el-row>
        <el-row>
          <el-form-item label="工作经验" style="width:44%">
            <el-input v-model="newResume.exp" clearable placeholder="(必填)">
              <template #append>年</template>
            </el-input>
          </el-form-item>
          <el-form-item label="语言水平" style="width: 43%">
            <el-input v-model="newResume.language" clearable/>
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="期望城市" style="width:44%">
            <el-input v-model="newResume.city" clearable >
            </el-input>
          </el-form-item>
          <el-form-item label="现居城市" style="width: 43%">
            <el-input v-model="newResume.address" clearable/>
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="教育水平" style="width:44%">
            <el-select v-model="newResume.levelstudy">
              <el-option label="高中及以下" value="0"/>
              <el-option label="专科" value="1"/>
              <el-option label="本科" value="2"/>
              <el-option label="硕士" value="3"/>
              <el-option label="博士" value="4"/>
            </el-select>
          </el-form-item>
          <el-form-item label="毕业院校" style="width: 43%">
            <el-input v-model="newResume.university" clearable/>
          </el-form-item>
        </el-row>
          <el-form-item label="所学专业">
            <el-input v-model="newResume.major"/>
          </el-form-item>
      </el-form>


    </span>


    <template #footer>
      <el-button @click="addition=false">取消</el-button>
      <el-button @click="addResume" type="primary">录入</el-button>
    </template>
  </el-dialog>
</template>

<script>
import {ref} from 'vue'
import request from "@/utils/request";

export default {
  name: "MyResume",
  components: {},
  data() {
    return {
      t1: "primary",
      t2: "default",
      t3: "default",
      t4: "default",
      ResumeList: [],
      dialogVisible: false,
      resumeSelect: {},
      findmodel: 0,
      addition: false,
      newResume: {},
      adid: JSON.parse(sessionStorage.getItem("administrator"))['username']

    }
  },
  created() {
    this.findmodel = 0
    this.load()
  },
  methods: {
    load() {
      request.get("/resume/Myfind", {
        params: {
          adid: this.adid,
          model: this.findmodel
        }
      }).then(res => {
        console.log(res)
        this.ResumeList = res.data
        this.total = res.data.total
      })
    },
    myaddition() {
      this.findmodel = 1
      this.load()
    },
    myhandle() {
      this.findmodel = 2
      this.load()
    },
    addResume() {
      this.newResume.adid = this.adid
      this.newResume.time=new Date()
      this.newResume.mine=true
      request.post("/resume/addByAdmin",this.newResume).then(res=>{
        if(res.code === '0'){
          this.$message({
            type:"success",
            message:"信息录入成功"
          })
          this.addition=false;
        }
      })
      this.addition = false
    }
  },
}
</script>

<style scoped>


</style>